'''
@Project ：my_python_project 
@File    ：模拟撞库.py
@IDE     ：PyCharm 
@Author  ：xionglinhui
@Date    ：2024/9/23 下午3:17 
'''
import hashlib

# '''
# 示范1：'lin123' 的md5加密后的hash值为 67d0d20751175881bd2f8ece381b5dfd
# '''
# m = hashlib.md5('lin123'.encode('utf-8'))
# print(m.hexdigest())   # 'lin123' 的md5加密后的hash值为 67d0d20751175881bd2f8ece381b5dfd

cryptography = '67d0d20751175881bd2f8ece381b5dfd'

passwd = [
    'lin213',
    'lin111',
    'lin222',
    'lin123',
    'lin321'
]

dic={}
for i in passwd:
    m = hashlib.md5(i.encode('utf-8'))
    dic[i] = m.hexdigest()

for k, v in dic.items():
    if dic[k] == cryptography:
        print(f'解密后的密码为{k}')
        break
    else:
        print(f'k值为{k},v值为{v}')
        print('解密中....')